
// 需要镜像处理的节点
cc.Class({
    extends: cc.Component,

    properties: {
        // 需要翻转的子节点
        retainSideNodes: {
            type: cc.Node,
            default: [],
        }
    },

    switchSide: function () {
        this.node.scaleX = -this.node.scaleX;
        for (let i = 0; i < this.retainSideNodes.length; ++i) {
            const curNode = this.retainSideNodes[i];
            curNode.scaleX = -curNode.scaleX;
        }
    }
});
